<template>
	<view>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="content">登陆</block>
		</cu-custom>
		<view class="Btn">
			<button class="btn" @tap="land()">登陆</button>
			<button class="btn_a">取消</button>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code:''
			}
		},
		onLoad(){
			this.getcode()
		},
		methods: {	
			getcode(){
				uni.login({
					provider:'weixin',
					success: (res) => {
						this.code = res.code
					},
					
				})
				
			},
			
			land(){
				var postdata = {}
				console.log(postdata)
				uni.getUserProfile({
					desc:"获取信息",
					success: (res) => {
						console.log(res)
						postdata.encryptedData = res.encryptedData
						postdata.iv = res.iv
						postdata.code = this.code
						uni.request({
							url:"https://wxzx.gzzww.cn/api/wx_app_login",
							data:postdata,
							method:"POST",
							success: (res) => {
								console.log(res)
							}
						})
					}
				})
				
			}
			
		}
		
	}
</script>

<style>
	.Btn{
		display: flex;
	}
.btn{
	height: 100rpx;
	width: 150rpx;
	border-radius: 2500rpx;
	border: 1rpx solid #1CBBB4;
}
.btn_a{
	margin-left: 50rpx;
	height: 100rpx;
	width: 150rpx;
	border-radius: 2500rpx;
	border: 1rpx solid #1CBBB4;
}
</style>
